package com.yenchingcheng.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Yenchingcheng
 * @Date 2023/7/31 15:54
 * @Description 雇员类--里面有一个泛型为雇员类的List
 **/
public class Employee {

    private String name;
    private String dept;
    private int salary;
    private List<Employee> employeeList;

    public Employee(String name, String dept, int salary) {
        this.name = name;
        this.dept = dept;
        this.salary = salary;
        this.employeeList = new ArrayList<Employee>();
    }

    public void add(Employee employee) {
        employeeList.add(employee);
    }

    public void remove(Employee employee) {
        employeeList.remove(employee);
    }

    public List<Employee> getEmployeeList() {
        return employeeList;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", dept='" + dept + '\'' +
                ", salary=" + salary + '\'' +
                '}';
    }
}
